# Contributor: Christophe BERAUD-DUFOUR <christophe.berauddufour@gmail.com>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=yubico-piv-tool
pkgver=2.5.2
pkgrel=0
pkgdesc="PIV Tools for yubikey"
url="https://developers.yubico.com/yubico-piv-tool"
arch="all"
license="BSD-2-Clause"
makedepends="
	check-dev
	cmake
	gengetopt-dev
	help2man
	openssl-dev
	pcsc-lite-dev
	samurai
	zlib-dev
	"
subpackages="$pkgname-static $pkgname-dev $pkgname-libs $pkgname-doc"
source="https://developers.yubico.com/yubico-piv-tool/Releases/yubico-piv-tool-$pkgver.tar.gz
	werror.patch
	"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr

	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
522a163be55dd92c2f18a779b64b1a163a6f81390757db34b58e909d896d78bcff30907eb8a2dc703d70133cdd71e2d3841d36d77cf7211351b5c825965dffd0  yubico-piv-tool-2.5.2.tar.gz
1475032b9588bb56026a9850a041e7e287502fc53a7efe038c11ea60d719c166199f990a2760ff18b31c57be287825553de76dc79faf59e9d4064bfa8c01b31f  werror.patch
"
